package com.lorizz.docrepo.security;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

public class DummyAuthenticationService implements AuthenticationService {
    
    private List<String> roles = new ArrayList<String>();

    @Override
    public boolean authenticate(String username, String password) {
        return true;
    }

    @Override
    public List<String> getRoles(String username) {
        return roles;
    }

    @Override
    public void init(Map<String, ?> config) {
        Object r = config.get("roles");
        if (r == null)
            return;
        String str = (String) r;
        roles.addAll(Arrays.asList(str.split(",")));
    }

}
